package com.cdl.collectiontest;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Deom11 {
    public static void main(String[] args) {
        Collection<String> c= new ArrayList<>();
        c.add("a");
        c.add("b");
        c.add("c");
        c.add("d");
        c.add("e");
        c.add("f");


        System.out.println(c);

        //获取迭代器的对象
        // System.out.println(iterator.next());
        // System.out.println(iterator.next());
        // System.out.println(iterator.next());
        // System.out.println(iterator.next());
        // System.out.println(iterator.next());

        //通过循环+迭代器的方式
        for (String s : c) {
            System.out.println(s);
        }

        for (String s : c) {
            System.out.println(s);
        }




    }
}
